#include<iostream>
#include"CMemFinder.h"


int main()
{
	DWORD nProcessID;
	std::cout << "input processID:" << std::endl;
	std::cin >> nProcessID;

	CMemFinder Finder(nProcessID);

	if (!Finder.IsValid())
	{
		system("pause");
		return -1;
	}
	DWORD dwValue;
	std::cout << "input first value:";
	std::cin >> dwValue;
	if (Finder.FindFirst(dwValue))
	{
		while (Finder.GetListConst() > 1)
		{
			std::cout << "input a next value:";
			std::cin >> dwValue;
			Finder.FindNext(dwValue);
		}
	}
	else
	{
		std::cout << "finder error!";
		system("pause");
	}
	std::cout << "input a new value:";
	std::cin >> dwValue;

	if (Finder.WriteMemory(dwValue))
		std::cout << "success" << std::endl;
	else
		std::cout << "write error";


	printf("\n%d", GetLastError());
	system("pause");
	return 0;
}